﻿using DotNetCore.CAP;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApplication.Controllers
{
    /// <summary>
    /// cap订阅
    /// </summary>
    [ApiController]
    [Route("BaseData/[controller]")]
    public class SubController : ControllerBase
    {
        private readonly ILogger<SubController> _logger;
        public SubController(ILogger<SubController> logger)
        {
            _logger = logger;
        }

        [NonAction]
        [CapSubscribe("helloworld")]
        public async Task CheckReceivedMessage(DateTime time)
        {
            Console.WriteLine(time);
            _logger.LogDebug(time.ToString());
            _logger.LogError(time.ToString());
            _logger.LogInformation(time.ToString());
            _logger.LogTrace(time.ToString());
            _logger.LogWarning(time.ToString());
            await Task.CompletedTask;
        }
    }
}
